from websocket import create_connection
def main():
    url = 'ws://127.0.0.1:9999/ws'
    ws = create_connection(url)
    print("获取连接状态：", ws.connected)
    while True:
        data = input('发送数据>>>>')
        ws.send(data)
        response = ws.recv()
        print("接收数据>>>>", response)
        if response=='close':
            ws.close()
if __name__ == '__main__':
    main()
